//
//  HomeCollectionCell.m
//  pmmSS
//
//  Created by Mac book on 2017/9/7.
//  Copyright © 2017年 WTFSSD. All rights reserved.
//

#import "HomeCollectionCell.h"



#define imageUrl @"http://image.baidu.com/search/detail?ct=503316480&z=0&ipn=d&word=材料&step_word=&hs=0&pn=2&spn=0&di=2037894210&pi=0&rn=1&tn=baiduimagedetail&is=0%2C0&istype=2&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=-1&cs=2079125256%2C2669332040&os=1715896471%2C142648700&simid=4288572390%2C774669971&adpicid=0&lpn=0&ln=1974&fr=&fmq=1505182788479_R&fm=result&ic=0&s=undefined&se=&sme=&tab=0&width=&height=&face=undefined&ist=&jit=&cg=&bdtype=0&oriquery=&objurl=http%3A%2F%2Fphotocdn.sohu.com%2F20150827%2FImg419910155.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F65ss_z%26e3Bf5i7_z%26e3Bv54AzdH3Fda8cabd0AzdH3Fg98ll8a8cn_z%26e3Bfip4s&gsm=0&rpstart=0&rpnum=0"

@implementation HomeCollectionCell


-(id)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {


        [self iniSubViews];
    }
    return self;
}

-(void)iniSubViews{


 

    NSLog(@"self.frame.size.width======== %f", self.frame.size.width);

    _iconLabel = [HMLabel createLabelWithText:@"工型钢" andTextColor:[UIColor blackColor] andBgColor:nil andFont:[UIFont fontWithName:@"" size:15] andTextAlignment:NSTextAlignmentCenter];


    [self.contentView addSubview:_iconLabel];

    _priceLabel = [HMLabel createLabelWithText:@"￥3366" andTextColor:[UIColor redColor] andBgColor:nil andFont:[UIFont fontWithName:@"" size:15] andTextAlignment:NSTextAlignmentCenter];


    [self.contentView addSubview:_priceLabel];



    _imageView = [[UIImageView alloc]init];
    _imageView.backgroundColor = [UIColor yellowColor];

   // [_imageView setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://image.baidu.com/search/detail?ct=503316480&z=0&ipn=d&word=材料&step_word=&hs=0&pn=2&spn=0&di=2037894210&pi=0&rn=1&tn=baiduimagedetail&is=0%2C0&istype=2&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=-1&cs=2079125256%2C2669332040&os=1715896471%2C142648700&simid=4288572390%2C774669971&adpicid=0&lpn=0&ln=1974&fr=&fmq=1505182788479_R&fm=result&ic=0&s=undefined&se=&sme=&tab=0&width=&height=&face=undefined&ist=&jit=&cg=&bdtype=0&oriquery=&objurl=http%3A%2F%2Fphotocdn.sohu.com%2F20150827%2FImg419910155.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F65ss_z%26e3Bf5i7_z%26e3Bv54AzdH3Fda8cabd0AzdH3Fg98ll8a8cn_z%26e3Bfip4s&gsm=0&rpstart=0&rpnum=0"]]]];

   // [_imageView sd_setImageWithURL:[NSURL URLWithString:imageUrl]];

    [_imageView setImage:[UIImage imageNamed:@"list_icon_shop"]];

     [self.contentView addSubview:_imageView];

    [_iconLabel mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.mas_equalTo(autoScaleW(10));
        make.top.mas_equalTo(autoScaleH(15));
         make.width.mas_equalTo((self.frame.size.width-autoScaleW(20))/2);
        make.height.mas_equalTo(autoScaleH(25));


    }];

  
    [_priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.mas_equalTo(autoScaleW(10));
        make.top.mas_equalTo(_iconLabel.mas_bottom).offset(autoScaleH(5));
        make.width.mas_equalTo((self.frame.size.width-autoScaleW(20))/2);
        make.height.mas_equalTo(autoScaleH(25));

        
    }];

    [_imageView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.mas_equalTo(_iconLabel.mas_right).offset(autoScaleW(10));
        make.top.mas_equalTo(autoScaleH(10));

        make.right.mas_equalTo(autoScaleH(-10));
//        make.width.mas_equalTo(self.frame.size.width/2);
//        make.height.mas_equalTo(autoScaleH(30));

        make.bottom.mas_equalTo(autoScaleW(-10));




    }];

}

-(void)reloadWithModel:(HomeCollectionCell *)model{





}
@end
